package com.pft.web;

import android.app.DownloadManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;

import com.pft.web.util.UpgradeManager;

/**
 * download complete
 * Created by zx on 2016-7-28.
 */
public class DownLoadManagerBroadCastReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        long myDwonloadID = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, 0L);
        String localID = UpgradeManager.getApkDownloadQueueID();
        if (TextUtils.equals(localID, String.valueOf(myDwonloadID))) {
                UpgradeManager.installApp(context);
        }
        UpgradeManager.saveApkDownloadQueueID("");
    }

}
